// const obj = { name: "John", age: 30, hobbies: ["coding", "gaming"] };

// // 对象转 JSON 字符串
// const jsonString = JSON.stringify(obj); 
// console.log(jsonString); 
// // 输出：'{"name":"John","age":30,"hobbies":["coding","gaming"]}'

const jsonString = '{"name":"John","age":30,"isStudent":false}';

// JSON 字符串转对象
const parsedObj = JSON.parse(jsonString); 
console.log(parsedObj);
console.log(parsedObj.name); // "John"
console.log(parsedObj.isStudent); // false